package com.zhanglong.kotlinfish.Util.HardWare

import android.content.Context
import android.media.MediaPlayer

class BGMPlayerUtil {

    private var mediaPlayer: MediaPlayer

    constructor(context: Context, resourceId: Int) {
        mediaPlayer = MediaPlayer.create(context, resourceId)
        mediaPlayer.isLooping = true
    }

    fun play() {
        mediaPlayer.start()
    }

    fun pause() {
        mediaPlayer.pause()
    }

    fun stop() {
        mediaPlayer.stop()
    }

    fun isPlaying(): Boolean {
        return mediaPlayer.isPlaying
    }
}